package com.wbs.shop.nuby.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.ArrayMap;

import com.wbs.shop.nuby.App;
import com.wbs.shop.nuby.commom.Key;

/**
 * Created by zhoucl on 2017/4/25 0025.
 */

public class DOMStorageUtils {
    private static final ArrayMap<String, String> sessionStorage = new ArrayMap<>();
    private static final SharedPreferences localStorage;

    static {
        localStorage = App.getApp().getSharedPreferences(Key.PREFERENCES_DOM, Context.MODE_PRIVATE);
    }

    public static void putSession(String key, String value) {
        putLocal(key, value);
    }

    public static String getSession(String key) {
        return getLocal(key);
    }

    public static void putLocal(String key, String value) {
        SharedPreferences.Editor editor = localStorage.edit();
        editor.putString(key, value);
        editor.commit();
    }

    public static String getLocal(String key) {
        return localStorage.getString(key, "");
    }
}
